
<%@ page import="baratopradedeu.Oferta" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'oferta.label', default: 'Oferta')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.nova.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
							<!--
                            <g:sortableColumn property="id" title="${message(code: 'oferta.id.label', default: 'Id')}" />
							-->
                            <g:sortableColumn property="titulo" title="${message(code: 'oferta.titulo.label', default: 'Oferta')}" />
							
							<g:sortableColumn property="destaque" title="${message(code: 'oferta.destaque.label', default: 'Destaque')}" />
                        
                            <g:sortableColumn property="imagem" title="${message(code: 'oferta.imagem.label', default: 'Imagem')}" />
														
                            <g:sortableColumn property="categoriaOferta" title="${message (code: 'oferta.categoriaOferta.label', default: 'Categoria')}" />
							
							<g:sortableColumn property="dataInicial" title="${message(code: 'oferta.dataInicial.label', default: 'Data Inicial')}" />
							<g:sortableColumn property="dataFinal" title="${message(code: 'oferta.dataFinal.label', default: 'Data Final')}" />
                        
                            <g:sortableColumn property="convites" title="Enviar oferta" />
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${ofertaInstanceList}" status="i" var="ofertaInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
							<!--
                            <td><g:link action="show" id="${ofertaInstance.id}">${fieldValue(bean: ofertaInstance, field: "id")}</g:link></td>
							-->
                            <td><g:link action="show" id="${ofertaInstance.id}">${fieldValue(bean: ofertaInstance, field: "titulo")}</g:link></td>
							
							<td><g:link action="show" id="${ofertaInstance.id}">${fieldValue(bean: ofertaInstance, field: "destaque")}</g:link></td>
                        
                            <td><g:link action="show" id="${ofertaInstance.id}">${fieldValue(bean: ofertaInstance, field: "imagem")}</g:link></td>
							
							<td>${fieldValue(bean: ofertaInstance, field: "categoriaOferta")}</td>
                        
                            <td><g:formatDate format="dd/MM/yyyy" precision="day" date="${ofertaInstance.dataInicial}" /></td>
							
							<td><g:formatDate format="dd/MM/yyyy" precision="day" date="${ofertaInstance.dataFinal}" /></td>
                                                
                            <td><a href src="#" onclick="javascrit:alert('Oferta enviada para todos os clientes com sucesso.');">Enviar Email</a></td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${ofertaInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
